import { destName } from '@/utils/common/fns'

export const statusList = [
  {
    id: '1',
    name: '启用',
  },
  {
    id: '2',
    name: '停用',
  },
]

export function statusFormatter(row) {
  const dest = destName(statusList, row.status)
  if (!dest) {
    return '停用'
  }
  return dest
}

export function filterFrom(columns, filterList, isInclude = true) {
  if (isInclude) {
    return filterList.map((prop) => columns.find((col) => col.prop === prop))
  } else {
    return columns.filter((col) => !filterList.some((prop) => col.prop === prop))
  }
}
